package com.project.personalfundmanager.client.taxitems;

import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.project.personalfundmanager.client.common.Const;
import com.project.personalfundmanager.shared.models.Section24Model;

public class Section24Item extends ParentItem<Section24Model>
{
	public Section24Item( Section24Model model )
	{
		super( model );
	}

	public void addFormComponents(FormPanel formPanel, boolean isEditable)
	{
		addToPanel(formPanel,uiHelper.getNumberField( "Income from Let out Property (Loss)", Const.LET_OUT_LOSS, isEditable, 999999999 ) );
		addToPanel(formPanel,uiHelper.getNumberField( "Income from Let out Property (Profit)", Const.LET_OUT_PROFIT,isEditable, 999999999 ) );
		addToPanel(formPanel,uiHelper.getNumberField( "Interest on Housing Loan", Const.LOAN_INTEREST,isEditable, 150000 ) );
	}

	public void addTotalComponents(FormPanel totalPanel)
	{
		addToPanel( totalPanel,uiHelper.getNumberField( "Total", Const.SEC24_TOTAL, false ) );
	}

	public void calculateTotal()
	{
		int total = model.getLetoutProfit() - model.getLetoutLoss() + model.getLoanInterest();
		model.setTotal( total );
	}
}
